package com.gogowan.agroenterprise.newview;

import android.app.DatePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.DatePicker;
import android.widget.ImageButton;
import android.widget.TextView;

import com.gogowan.agroenterprise.R;
import com.gogowan.agroenterprise.base.BaseActivity;
import com.gogowan.agroenterprise.db.DBHelper;
import com.gogowan.agroenterprise.model.CollectData;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

public class NewCollectSelectHistory extends BaseActivity {
    String data="";
    int mYear,mMonth,mDay;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_newview_selectriqi_history);
        initView();
    }
    private void initView() {
        initTitle("离线缓存");
        Calendar ca = Calendar.getInstance();
        mYear = ca.get(Calendar.YEAR);
        mMonth = ca.get(Calendar.MONTH);
        mDay = ca.get(Calendar.DAY_OF_MONTH);
    }
    private void initTitle(String TitleName){
        TextView titleName=(TextView)findViewById(R.id.all_top_title);
        ImageButton top=(ImageButton)findViewById(R.id.all_top_back_btn);
        titleName.setText(TitleName);
        top.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
    public void ShowTimeper(View view){
        new DatePickerDialog(NewCollectSelectHistory.this,dateSetListener, mYear, mMonth, mDay).show();
    }
    public void GoHisoryListActivity(View view){
        Intent intent=new Intent(NewCollectSelectHistory.this,NewCollectHistory.class);
        intent.putExtra("Data",data);
        startActivity(intent);
    }
    private DatePickerDialog.OnDateSetListener dateSetListener=new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
            mYear = year;
            mMonth = monthOfYear;
            mDay = dayOfMonth;
            data=mYear+"/"+mMonth+"/"+mDay;
            TextView riqitv=(TextView) findViewById(R.id.riqi_tv);
            riqitv.setText(data);
        }
    };
}
